package designpattern.compement;

import java.util.ArrayList;
import java.util.List;

/**
 * TODO:类描述
 *
 * @className: Files
 * @packageName: designpattern.compement
 * @author: Zhuhj
 * @version: V1.0
 * @date: 2021/4/19 22:38
 */
public class Files extends Compement{
    List<Compement> compements = new ArrayList<Compement>();
    public Files(String name){
        super(name);
    }
    @Override
    void addCompement(Compement compement) {
        compements.add(compement);
    }

    @Override
    void removeCompement(Compement compement) {
        compements.remove(compement);
    }

    @Override
    void display(int deep) {
        System.out.println(deep +" "+ getName());
        compements.forEach(com->{
            com.display(deep+1);
        });
    }
}
